package gui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;

import core.ImageLibrary;

public class GameTextLabel extends MenuItem {

	String label;

	public GameTextLabel(String text_, int xpos, int ypos, int width, int height) {
		super(xpos, ypos, width, height);
		label = text_;

		generateImage();
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String newLabel) {
		label = newLabel;
		generateImage();
	}

	@Override
	public void render(Graphics2D g2d) {
		// TODO Auto-generated method stub
		g2d.setColor(Color.black);
		super.render(g2d);
	}

	@Override
	public void generateImage() {
		// TODO Auto-generated method stub
		image = getLabelImage(label);
	}

	public Image getLabelImage(String text) {
		Image img = null;
		img = ImageLibrary.getInstance().createEmptyImage(this.getSize().width,
				this.getSize().height);
		Graphics gimg = img.getGraphics();
		gimg.setColor(Color.black);
		// gimg.fillRect(0 , 0 ,this.getSize().width, this.getSize().height);
		gimg.drawString(text, 12, 16);
		return img;
	}

	@Override
	public void updateLogic() {
		// TODO Auto-generated method stub
		super.updateLogic();
	}

}
